import request from '@/utils/request'

// 从配置中获取业务的地址
import { baseUrlConfig } from '@/config/config'
const basePath = baseUrlConfig.businessBaseUrl

// 获取分页列表
export const maintenancePageList = (data: any) => {
  return request({
    url: basePath + '/eqpt/devive/find/page',
    method: 'post',
    data
  })
}

//TOC接口
export const getFindTree = (data: any) => {
  return request({ 
    url: basePath + "/eqpt/type/find/tree",
    method: "post",
    data,
  });
};

// 删除
export const maintenanceDeleteRow = (eqptId: any) => {
  return request({
    url: basePath + '/eqpt/devive/delete?eqptId=' + eqptId,
    method: 'GET'
  })
}

// 下载模板
export const maintenanceModuleDown = () => {
  return request({
    url: basePath + '/eqpt/devive/download',
    responseType: 'blob',
    method: 'post'
  })
}

// 导入
export const maintenanceImport = (data: any) => {
  return request({
    url: basePath + '/eqpt/devive/import',
    method: 'post',
    data
  })
}

// 导出当前页的数据
export const exportMaintenancePageList = (data: object) => {
  return request({
    url: basePath + '/eqpt/devive/export',
    method: 'POST',
    responseType: 'blob',
    data
  })
}

// 增加
// @ts-ignore
export const maintenanceSave = (data: any) => {
  return request({
    url: basePath + '/eqpt/devive/save',
    method: 'post',
    data
  })
}

// 维护提醒
export const maintenanceTips = (cycleData: any) => {
  return request({
    url: basePath + '/eqpt/devive/reminder?cycle=' + cycleData,
    method: 'post'
  })
}

// 维护更新
export const maintenanceUpdata = (data: any) => {
  return request({
    url: basePath + '/eqpt/devive/maintenance',
    method: 'post',
    data
  })
}

// 维护历史记录更新
export const maintenanceRecordsUpdata = (data: any) => {
  return request({
    url: basePath + '/eqpt/devive/update',
    method: 'post',
    data
  })
}

// 获取用户信息
export const getUserInfo = (data: any) => {
  return request({
    url: basePath + '/user/find',
    method: 'post',
    data
  })
}

// 获取设备类型
export const getFindDeviceTypeTree = (data: any) => {
  return request({
    url: basePath + '/eqpt/type/find/tree',
    method: 'post',
    data
  })
}
